<template>
	<view class="m30">
		<view class="bgFff radius30 p30">
			<view class="">
				<u--textarea v-model="form.title" placeholder="好标题可获得更多浏览" count border="none" height="80" autoHeight
					maxlength="30"></u--textarea>
			</view>
			<u-line color="#ddd" margin="20rpx 0"></u-line>
			<view class="">
				<u--textarea v-model="form.sceneDesc" :placeholder="`请输入${type==1?'Plog':'Vlog'}描述`" count border="none"
					height="200" maxlength="5000"></u--textarea>
			</view>
		</view>
		<u-gap height="10"></u-gap>
		<view class="bgFff radius30 p30">
			<view class="" v-if="type == 1">
				<view class="">
					<u-upload :fileList="imgList" @afterRead="(e)=>{afterRead(e,'imgList')}" @delete="deletePic"
						name="1" multiple uploadIcon="photo" :maxCount="20" width="100" height="100">
						<view class="upload_box bgF7">
							<image src="../../static/images/you/add.png" mode="" style="width: 60rpx;height: 60rpx;">
							</image>
							<view class="c999 f24">点击上传图片</view>
						</view>
					</u-upload>
				</view>
				<view class="c666 f24 mt10">请上传1-20张图片，每张不超过60MB</view>
			</view>
			<view class="" v-else>
				<view class="flex">
					<view class="mr20" @click="show_video_btn">
						<u-upload :fileList="videoList" @afterRead="(e)=>{afterRead(e,'videoList')}"
							@delete="deleteVideo" name="1" multiple uploadIcon="photo" accept="video" :maxCount="1"
							width="100" height="100">
							<view class="upload_box bgF7">
								<image src="../../static/images/you/add_v.png" mode=""
									style="width: 60rpx;height: 60rpx;"></image>
								<view class="c999 f24">点击上传视频</view>
							</view>
						</u-upload>
					</view>
					<view class="">
						<u-upload :fileList="coverList" @afterRead="(e)=>{afterRead(e,'coverList')}"
							@delete="deleteCoverPic" name="1" multiple uploadIcon="photo" :maxCount="1" width="100"
							height="100">
							<view class="upload_box bgF7">
								<image src="../../static/images/you/add.png" mode=""
									style="width: 60rpx;height: 60rpx;"></image>
								<view class="c999 f24">点击上传封面图</view>
							</view>
						</u-upload>
					</view>
				</view>
				<view class="c666 f24 mt10">请上传长度5秒至3分钟的视频</view>
			</view>
			<u-gap height="30"></u-gap>
			<view class="flex-jus" @click="chooseAddress">
				<view class="left-label">
					<image src="../../static/images/you/address.png" mode="" style="width: 48rpx;height: 48rpx;">
					</image>
				</view>
				<view class="flex1 ml30">
					<view class="flex-jus">
						<text class="f26 mr20" :class="form.addr?'c343':'c999'">{{form.addr || '添加地点'}}</text>
						<u-icon name="arrow-right" color="#34314F"></u-icon>
					</view>
				</view>
			</view>
			<u-line color="#ddd" margin="30rpx 0"></u-line>
			<!-- <view class="">
				<view class="left-label flex">
					<image src="../../static/images/you/correlation.png" mode="" style="width: 48rpx;height: 48rpx;">
					</image>
					<text class="c343 f26 ml20">关联栏目</text>
				</view>
				<view class="flex-jus mt20">
					<view class="bgF7 radiusBox flex-jus p10 flex1" @click="getType(1)">
						<text class="f24 mr20" :class="type1.id?'c343':'c999'">{{type1.title || '一级栏目'}}</text>
						<u-icon name="arrow-down-fill" color="#999" size="12"></u-icon>
					</view>
					<view class="bgF7 radiusBox flex-jus p10 flex1 ml20" @click="getType(2)">
						<text class="f24 mr20" :class="type2.id?'c343':'c999'">{{type2.title || '二级联动'}}</text>
						<u-icon name="arrow-down-fill" color="#999" size="12"></u-icon>
					</view>
					<view class="bgF7 radiusBox flex-jus p10 flex1 ml20" @click="getType(3)" v-if="type1.id == 1">
						<text class="f24 mr20 textoverflow" :class="type3.id?'c343':'c999'">{{type3.title || '三级联动'}}</text>
						<u-icon name="arrow-down-fill" color="#999" size="12"></u-icon>
					</view>
				</view>
			</view> -->
			<view class="flex" @click="getType(4)">
				<view class="left-label">
					<image src="../../static/images/you/correlation.png" mode="" style="width: 48rpx;height: 48rpx;">
					</image>
				</view>
				<view class="ml30 flex1">
					<view class="flex-jus">
						<text class="f26 mr20"
							:class="type1.title && type2.title?'c343':'c999'">{{type1.title && type2.title?(type1.title + '/' +  type2.title) : '请选择作品发布的板块'}}</text>
						<!-- <text class="f26 mr20" v-else
							:class="type1.title && type2.title && type3.title?'c343':'c999'">{{type1.title && type2.title && type3.title?(type1.title + '/' +  type2.title + '/' + type3.title) : '请选择作品发布的板块'}}</text> -->
						<u-icon name="arrow-right" color="#34314F"></u-icon>
					</view>
				</view>
			</view>
			<!-- <u-line color="#ddd" margin="30rpx 0"></u-line>
			<view class="flex" @click="getType(5)">
				<view class="left-label">
					<u-icon name="bag" size="28"></u-icon>
				</view>
				<view class="ml30 flex1">
					<view class="flex-jus">
						<text class="f26 mr20"
							:class="tungoutitle?'c343':'c999'">{{tungoutitle? tungoutitle : '请选择需要发布的团购商品'}}</text>
						<u-icon name="arrow-right" color="#34314F"></u-icon>
					</view>
				</view>
			</view> -->
			<u-line color="#ddd" margin="30rpx 0"></u-line>
			<view class="">
				<view class="left-label flex">
					<image src="../../static/images/you/tag.png" mode="" style="width: 48rpx;height: 48rpx;"></image>
					<text class="c343 f26 ml20">标签</text>
				</view>
				<view class="mt20 flex">
					<view class="tag flex p10 mr10 radius50" v-for="(item,index) in tagList" :key="index">
						<text class="f24 mr10 c999 textoverflow">{{item}}</text>
						<u-icon name="close" color="#999" size="12" @click="delTag(index)"></u-icon>
					</view>
					<view class="bgF7 radius50 flex p10" @click="openTag">
						<u-icon name="plus" color="#999" size="12"></u-icon>
						<text class="f24 ml10 c999">自定义标签</text>
					</view>
				</view>
			</view>
		</view>
		<u-gap height="100"></u-gap>
		<view class="fix-bot bgFff">
			<view class="flex m30">
				<view class="flex mr30" @click="checkForm(2)">
					<image src="../../static/images/you/cg.png" mode="" style="width: 54rpx;height: 54rpx;"></image>
					<text class="c343 f26 ml10">存草稿</text>
				</view>
				<view class="flex1 ml30">
					<u-button color="#FFDE6D" :customStyle="{'color':'#34314F'}" shape="circle"
						@click="checkForm(1)">发布作品</u-button>
				</view>
			</view>
			<u-gap height="10"></u-gap>
		</view>
		<!-- 添加标签 -->
		<u-popup :show="show_tag" @close="show_tag = false" mode="center" @open="openTag" closeable round="20"
			:customStyle="{'width':'80%'}">
			<view class="p30">
				<view class="c343 bold">添加标签</view>
				<u-gap height="20"></u-gap>
				<view class="">
					<u--textarea v-model="tageText" placeholder="请输入标签内容" count border="none" autoHeight
						maxlength="10"></u--textarea>
				</view>
				<u-gap height="20"></u-gap>
				<view class="flex-au">
					<u-button color="#FFDE6D" :customStyle="{'color':'#34314F','height':'80rpx','width':'40%'}"
						shape="circle" @click="tagSubmit">确定</u-button>
				</view>
			</view>
		</u-popup>
		<!-- 确认发布 -->
		<u-popup :show="show_sure" @close="show_sure = false" mode="center" @open="show_sure = true"
			:closeOnClickOverlay="false" round="20" :customStyle="{'width':'80%'}">
			<view class="p30">
				<view class="c343 bold textC">确认此操作？</view>
				<u-gap height="20"></u-gap>
				<view class="">
					<text class="c343 f26">作品必须为本人原创，如因使用他人素材或作品引起的法律纠纷将由您个人承担因此所产生的一切法律责任包括但不限于赔偿金、律师费、诉讼费等。</text>
				</view>
				<u-gap height="20"></u-gap>
				<view class="flex-au">
					<view class="flex1 mr20">
						<u-button color="#f7f7f7" :customStyle="{'color':'#34314F','height':'80rpx'}" shape="circle"
							@click="show_sure = false">取消发布</u-button>
					</view>
					<view class="flex1 ml20">
						<u-button color="#FFDE6D" :customStyle="{'color':'#34314F','height':'80rpx'}" shape="circle"
							@click="submitForm">同意并发布</u-button>
					</view>
				</view>
			</view>
		</u-popup>
		<!-- 团购商品 -->
		<u-popup :show="show_tuangou" @close="show_tuangou = false" @open="show_tuangou = true" closeable round="20"
			bgColor="#FEF4E8">
			<view class="p30">
				<view class="c343 bold">选择团购商品</view>
				<u-gap height="20"></u-gap>
				<view class="tuangouwrap">
					<view class="tuangou mt20" @click="chooseshop(item)" v-for="(item,index) in goods" :key="index">
						<image :src="api_host+item.icon" style="width: 150rpx;height: 150rpx;border-radius: 15rpx;">
						</image>
						<view class="flex1">
							<p class="f32 fw500 ml20 textoverflow2">{{item.brand}} | {{item.goodName}}</p>
							<view class="f24 ml20 mt20" style="display: flex;flex-wrap: wrap;">
								<!-- <view class="item_tag m10" v-for="(item2,index2) in item.tags" :key="index2">{{item2}}
								</view> -->
								<view class="mr10 mb10" v-for="(item2,index2) in item.tags" :key="index2">
									<u-tag shape="circle" size="mini" color="#34314F" bgColor="#f7f7f7" :text="item2"
										borderColor="#f7f7f7"></u-tag>
								</view>
							</view>
						</view>
					</view>
				</view>

			</view>
		</u-popup>
		<!-- 栏目 -->
		<u-popup :show="show_type" @close="show_type = false" mode="center" @open="show_type = true" closeable
			round="20" :customStyle="{'width':'80%'}">
			<view class="p30">
				<view class="c343 bold">选择栏目</view>
				<u-gap height="20"></u-gap>
				<view class="">
					<u-radio-group v-model="modal_typeIndex" placement="column">
						<u-radio :customStyle="{margin: '8px 0'}" labelSize="14" activeColor="#FFDE6D"
							v-for="(item, index) in typeList" :key="index" :label="item.title" :name="index">
						</u-radio>
					</u-radio-group>
				</view>
				<u-gap height="20"></u-gap>
				<view class="flex-au">
					<u-button color="#FFDE6D" :customStyle="{'color':'#111','height':'80rpx','width':'40%'}"
						shape="circle" @click="typeConfirm">确定</u-button>
				</view>
			</view>
		</u-popup>
		<!-- 视频 -->
		<u-popup v-if="show_video" :show="show_video" @close="show_video = false" mode="center"
			@open="show_video = true" :customStyle="{'width':'90%','backgroundColor':'transparent'}">
			<view class="">
				<video :src="api_host + videoList[0].api_url" class="width100 radius30"></video>
			</view>
			<u-gap height="20"></u-gap>
			<view class="flex-au">
				<u-icon name="close-circle-fill" color="#000" size="26" @click="show_video = false"></u-icon>
			</view>
		</u-popup>
		<!-- 栏目 -->
		<u-popup :show="show_types" @close="show_types = false" mode="bottom" @open="show_types = true" closeable
			round="20">
			<view class="p30">
				<view class="c343 bold">请选择作品发布的板块</view>
				<u-gap height="20"></u-gap>
				<view class="flex flex-start">
					<view class="left-type textC">
						<view v-for="(item,index) in type1List" :key="index" class="f28 c343 type-item"
							:class="{'active':modal_typeIndex1 == index}" @click="sel_type(index,1)">{{item.title}}
						</view>
					</view>
					<view class="flex1 right-types ml20 mr20">
						<view v-if="modal_typeIndex1 == 0" class="flex-au flex-wrap">
							<view v-for="(item,index) in tourTypes" :key="index" class="wan-item mb20">
								<u-button shape="circle" color="#f7f7f7" size="mini"
									:customStyle="{'height':'70rpx','color':'#333','width':'95%'}"
									@click="sel_type(index,2)">{{item.title}}</u-button>
							</view>
						</view>
						<view v-if="modal_typeIndex1 == 1">
							<view v-for="(item,index) in storeTypes" :key="index" class="wan-item mb20">
								<u-button shape="circle" color="#f7f7f7" size="mini"
									:customStyle="{'height':'70rpx','color':'#333','width':'95%'}"
									@click="sel_type(index,3)">{{item.title}}</u-button>
							</view>
							<!-- <view v-for="(item,index) in storeTypes" :key="index" class="mb20 flex1">
								<view class="flex-jus">
									<text class="f26 c343 bold textoverflow">{{item.title}}</text>
									<view class="flex" v-show="item.children.length > 2"
										@click="open_children(item,index)">
										<text class="f24 c343">{{item.open?'收起':'展开'}}</text>
										<u-icon :name="item.open?'arrow-up':'arrow-down'" size="13"
											color="#333"></u-icon>
									</view>
								</view>
								<view>
									<view
										v-for="(item2,index2) in item.children.slice(0, item.open?item.children.length:2)"
										:key="index2" class="mt20">
										<u-button shape="circle" color="#f7f7f7" size="mini"
											:customStyle="{'height':'60rpx','color':'#333'}"
											@click="sel_type(index,3,index2)">{{item2.title}}</u-button>
									</view>
								</view>
							</view> -->
						</view>
						<view v-if="modal_typeIndex1 == 2" class="flex-au flex-wrap">
							<view v-for="(item,index) in sqTypes" :key="index" class="wan-item mb20">
								<u-button shape="circle" color="#f7f7f7" size="mini"
									:customStyle="{'height':'70rpx','color':'#333','width':'95%'}"
									@click="sel_type(index,4)">{{item.title}}</u-button>
							</view>
						</view>
					</view>
				</view>
				<!-- <u-gap height="20"></u-gap>
				<view class="flex-au">
					<u-button color="#FFDE6D" :customStyle="{'color':'#111','height':'80rpx','width':'40%'}"
						shape="circle" @click="typeConfirm">确定</u-button>
				</view> -->
			</view>
		</u-popup>
	</view>
</template>

<script>
	import appInfo from '@/common/appInfo.js'
	import {
		getVlogdetail,
		getVlogcate,
		getStore,
		createVlog,
		updateVlog
	} from '@/common/api_wan.js'
	import {
		getGoods
	} from '@/common/api_tuangou.js'
	export default {
		name: '',
		data() {
			return {
				from:'',
				id: '',
				show_sure: false,
				show_tag: false,
				show_video: false,
				show_tuangou: false,
				type: '', //1图片，2视频
				form: {
					title: '',
					sceneDesc: '',
					addr: '黄石市',
					goodsId: ''
				},
				modal_type: '',
				modal_typeIndex: 0,
				modal_typeIndex1: 0,
				modal_typeIndex2: 0,
				modal_typeIndex3: 0,
				modal_typeIndex4: 0,
				show_type: false,
				show_types: false,
				typeList: [],
				type1: {},
				type2: {},
				type3: {},
				type1List: [{
						title: '旅游',
						id: '2'
					},
					{
						title: '美食',
						id: '1'
					},
					{
						title: '社群',
						id: '3'
					}
				],
				storeTypes: [],
				tourTypes: [],
				sqTypes: [],
				type2List: [],
				type3List: [],
				tageText: '',
				tagList: [],
				imgList: [],
				videoList: [],
				coverList: [],
				status: '',
				goods: [],
				tags: [],
				tungoutitle: ''
			}
		},
		onLoad(option) {
			this.from = option.from || '';
			this.type = option.type
			this.getVlogcate()
			this.getGoods()
			if (option.id) {
				this.id = option.id
				this.getVlogdetail()
			}
			uni.setNavigationBarTitle({
				title: this.type == 1 ? '发布Plog' : '发布Vlog'
			})
		},
		methods: {
			chooseshop(item) {
				this.tungoutitle = item.brand + '|' + item.goodName
				this.form.goodsId = item.id
				this.show_tuangou = false
			},
			async getGoods() {
				let res = await getGoods()
				if (res.code == 200) {
					this.goods = res.data
					this.goods = res.data.map(item => {
						return {
							...item,
							tags: item.goodEmployValues ? item.goodEmployValues.split(',') : []
						}
					})
				}
			},
			async getVlogdetail() { //详情
				uni.showLoading({
					mask: true
				})
				const res = await getVlogdetail({
					id: this.id
				})
				if (res.code == 200) {
					let info = res.data
					this.form = {
						title: info.title,
						sceneDesc: info.sceneDesc,
						addr: info.addr
					}
					this.coverList = [{
						status: 'success',
						url: this.api_host + info.coverIcon,
						api_url: info.coverIcon
					}]
					if (info.resType == 1) {
						let imgData = []
						imgData = info.resContent.split(',')
						imgData.forEach(item => {
							this.imgList.push({
								status: 'success',
								url: this.api_host + item,
								api_url: item
							})
						})
					} else {
						let imgData = []
						imgData = info.resContent.split(',')
						imgData.forEach(item => {
							this.videoList.push({
								status: 'success',
								url: this.api_host + item,
								api_url: item
							})
						})
					}
					this.type1 = {
						title: info.relatedColumnName,
						id: info.relatedColumn
					}
					this.type2 = {
						title: info.relateTypeName,
						id: info.relateType
					}
					this.type3 = {
						title: info.subName,
						id: info.subId
					}
					this.tagList = info.vlogLabel ? info.vlogLabel.split('|') : []
				}
				uni.hideLoading()
			},
			async getVlogcate() {
				uni.showLoading({
					mask: true
				})
				const res = await getVlogcate()
				if (res.code == 200) {
					const {
						storeTypes,
						tourTypes,
						dynamicTypes
					} = res.data
					this.storeTypes = storeTypes.filter(item => item.children.length > 0)
					this.storeTypes.forEach(item => {
						item.open = false
					})
					this.tourTypes = tourTypes;
					this.sqTypes = dynamicTypes;
				}
				uni.hideLoading()
			},
			async getStore() {
				uni.showLoading({
					mask: true
				})
				const res = await getStore({
					id: this.type2.id
				})
				if (res.code == 200) {
					this.type3List = res.data
					if (this.type3List.length == 0) {
						uni.showToast({
							title: '该分类下暂无数据',
							icon: 'none'
						})
						return false
					}
					this.typeList = this.type3List
					this.show_type = true
				}
				uni.hideLoading()
			},
			// 删除图片
			deletePic(event) {
				this.imgList.splice(event.index, 1)
			},
			// 删除图片
			deleteVideo(event) {
				this.videoList.splice(event.index, 1)
			},
			// 删除图片
			deleteCoverPic(event) {
				this.coverList.splice(event.index, 1)
			},
			show_video_btn() {
				if (this.videoList[0].api_url) {
					this.show_video = true
				}
			},
			open_children(item, index) {
				item.open = !item.open
				this.$set(this.storeTypes, index, item)
			},
			async afterRead(event, key) {
				// 当设置 multiple 为 true 时, file 为数组格式，否则为对象格式
				let lists = [].concat(event.file)
				let fileListLen = this[key].length
				lists.map((item) => {
					this[key].push({
						...item,
						status: 'uploading',
						message: '上传中'
					})
				})
				for (let i = 0; i < lists.length; i++) {
					const result = await this.$utils.uploadFile(lists[i].url)
					if (result.code == 200) {
						let item = this[key][fileListLen]
						this[key].splice(fileListLen, 1, Object.assign(item, {
							status: 'success',
							message: '',
							url: this.api_host + result.full_url,
							api_url: result.full_url
						}))
						fileListLen++
					}
				}
				console.log(this[key]);
			},
			openTag() {
				this.tageText = ''
				this.show_tag = true
			},
			tagSubmit() {
				this.tagList.push(this.tageText)
				this.show_tag = false
			},
			delTag(index) {
				this.tagList.splice(index, 1)
			},
			chooseAddress() {
				const that = this
				uni.chooseLocation({
					success(res) {
						that.form.addr = res.name
					}
				})
			},
			sel_type(index, level, index2) {
				switch (level) {
					case 1:
						this.modal_typeIndex1 = index
						break;
					case 2:
						this.modal_typeIndex2 = index
						this.type1 = this.type1List[this.modal_typeIndex1]
						this.type2 = this.tourTypes[this.modal_typeIndex2]
						this.show_types = false
						break;
					case 3:
						this.modal_typeIndex2 = index
						this.modal_typeIndex3 = index2
						this.type1 = this.type1List[this.modal_typeIndex1]
						this.type2 = this.storeTypes[this.modal_typeIndex2]
						// this.type2 = this.storeTypes[this.modal_typeIndex2]
						// this.type3 = this.storeTypes[this.modal_typeIndex2].children[this.modal_typeIndex3]
						this.show_types = false
						break;
					case 4:
						this.modal_typeIndex2 = index;
						this.type1 = this.type1List[this.modal_typeIndex1]
						this.type2 = this.sqTypes[this.modal_typeIndex2]
						// this.type2 = this.storeTypes[this.modal_typeIndex2]
						// this.type3 = this.storeTypes[this.modal_typeIndex2].children[this.modal_typeIndex3]
						this.show_types = false
						break;
				}
			},
			getType(type) {
				this.modal_typeIndex = 0
				this.modal_type = type
				switch (type) {
					case 1:
						this.typeList = this.type1List
						this.show_type = true
						break;
					case 2:
						if (!this.type1.id) {
							uni.showToast({
								title: '请选择一级栏目',
								icon: 'none'
							})
							return false
						}
						this.getVlogcate()
						break;
					case 3:
						if (!this.type2.id) {
							uni.showToast({
								title: '请选择二级栏目',
								icon: 'none'
							})
							return false
						}
						this.getStore()
						break;
					case 4:
						this.typeList = this.type1List
						this.show_types = true
						break;
					case 5:
						this.show_tuangou = true

				}
			},
			typeConfirm() {
				switch (this.modal_type) {
					case 1:
						this.type1 = this.typeList[this.modal_typeIndex]
						this.type2 = {}
						this.type3 = {}
						break;
					case 2:
						this.type2 = this.typeList[this.modal_typeIndex]
						this.type3 = {}
						break;
					case 3:
						this.type3 = this.typeList[this.modal_typeIndex]
						break;
				}
				this.show_type = false
			},
			checkForm(status) {
				this.status = status
				if (!this.form.title) {
					uni.showToast({
						title: '请输入标题',
						icon: 'none'
					})
					return false
				}
				if (!this.form.sceneDesc) {
					uni.showToast({
						title: '请输入描述',
						icon: 'none'
					})
					return false
				}
				if (this.type == 1) {
					if (this.imgList.length == 0) {
						uni.showToast({
							title: '请上传图片',
							icon: 'none'
						})
						return false
					}
				} else {
					if (this.videoList.length == 0) {
						uni.showToast({
							title: '请上传视频',
							icon: 'none'
						})
						return false
					}
					if (this.coverList.length == 0) {
						uni.showToast({
							title: '请上传封面',
							icon: 'none'
						})
						return false
					}
				}

				if (!this.form.addr) {
					uni.showToast({
						title: '请选择地址',
						icon: 'none'
					})
					return false
				}
				if (!this.type1.id) {
					uni.showToast({
						title: '请选择一级栏目',
						icon: 'none'
					})
					return false
				}
				if (!this.type2.id) {
					uni.showToast({
						title: '请选择二级栏目',
						icon: 'none'
					})
					return false
				}
				// if (this.type1.id == 1) {
				// 	if (!this.type3.id) {
				// 		uni.showToast({
				// 			title: '请选择三级栏目',
				// 			icon: 'none'
				// 		})
				// 		return false
				// 	}
				// }
				if (this.status == 1) {
					this.show_sure = true
				} else {
					this.submitForm()
				}
			},
			async submitForm() {
				// #ifdef MP-WEIXIN
				let messageRes = await this.$utils.messageSubscriptionAuthorization(appInfo.tmplIds.workReply);
				// #endif
				this.show_sure = false
				let resContent = []
				let coverIcon = ''
				if (this.type == 1) {
					this.imgList.forEach(item => {
						resContent.push(item.api_url)
					})
					coverIcon = resContent[0]
				} else {
					this.videoList.forEach(item => {
						resContent.push(item.api_url)
					})
					coverIcon = this.coverList[0].api_url
				}
				let data = {}
				data = {
					title: this.form.title,
					sceneDesc: this.form.sceneDesc,
					resType: this.type,
					resContent: resContent.join(','),
					addr: this.form.addr,
					vlogLabel: this.tagList.join('|'),
					vlogStatus: this.status,
					relatedColumn: this.type1.id,
					relateType: this.type2.id,
					// subId: this.type3.id || '',
					coverIcon: coverIcon,
					goodsId: this.form.goodsId
				}
				uni.showLoading({
					mask: true
				})

				let res = null
				if (this.id) {
					res = await updateVlog({
						id: this.id,
						...data
					})
				} else {
					res = await createVlog(data)
				}
				if (res.code == 200) {
					uni.showToast({
						title: this.status == 1 ? '发布成功，请等待审核' : '草稿保存成功',
						icon: 'none'
					})
					setTimeout(() => {
						if(this.from == 'yujian'){
							uni.redirectTo({
								url: '/subpage/meethuangshi/index'
							})
						}else{
							uni.redirectTo({
								url: this.status == 1 ? '/pages/index/index?tab_index=4' :
									'/subpage/me/draft'
							})
						}
					}, 1000)
				}
				uni.hideLoading()
			}
		}
	}
</script>

<style lang="scss">
	.tuangouwrap {
		max-height: 600rpx;
		overflow: auto;
	}

	.tuangou {
		width: 688rpx;
		background: #FFFFFF;
		border-radius: 38rpx;
		padding: 30rpx;
		box-sizing: border-box;
		display: flex;

		.item_tag {
			width: 110rpx;
			height: 40rpx;
			font-weight: 400;
			color: #34314F;
			line-height: 40rpx;
			text-align: center;
			background-color: #ddd;
		}
	}


	page {
		background-color: #FEF4E8;
	}

	.upload_box {
		width: 100px;
		height: 100px;
		border-radius: 20rpx;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
	}

	.fix-bot {
		border-radius: 50rpx 50rpx 0 0;
	}

	.tag {
		max-width: 30%;
		border: 1px solid #f7f7f7;
	}

	.left-type {
		width: 30%;
		height: 500rpx;
		overflow-y: scroll;
		background-color: #f7f7f7;

		.type-item {
			height: 80rpx;
			line-height: 80rpx;
		}

		.active {
			background-color: #fff;
		}
	}

	.wan-item {
		width: 50%;
	}

	.right-types {
		height: 500rpx;
		overflow-y: scroll;
	}
</style>